//
//  PortView.m
//  CocoaSynth
//
//  Created by Thomas Dupont on 21/02/10.
//  Copyright 2010 Apple Inc. All rights reserved.
//

#import "PortView.h"

#import "PortViewController.h"

@implementation PortView

@synthesize controller;

#pragma mark -
#pragma mark Mouse events

- (void)mouseDown:(NSEvent *)theEvent
{
	inside = YES;
	[[[controller module] view] mouseDown:theEvent];
}

- (void)mouseUp:(NSEvent *)theEvent
{
	if (inside) {
		[controller portSelected];
	}
}

- (void)mouseExited:(NSEvent *)theEvent
{
	inside = NO;
}

- (void)mouseDragged:(NSEvent *)theEvent
{
	inside = NO;
	[[[controller module] view] mouseDragged:theEvent];
}

- (void)rightMouseUp:(NSEvent *)theEvent
{
	[controller disconnectPort];
}

@end
